import uicls
import uiconst
import uiutil
import uthread
import blue

class LoadingWheel(uicls.Transform):
    __guid__ = 'uicls.LoadingWheel'
    default_name = 'loadingWheel'
    default_width = 64
    default_height = 64
    default_pos = (0, 0, 64, 64)
    default_loopParams = (1, 1000.0)

    def ApplyAttributes(self, attributes):
        uicls.Transform.ApplyAttributes(self, attributes)
        sprite = uicls.Sprite(parent=self, texturePath='res:/UI/Texture/loadingWheel.dds', pos=(0, 0, 0, 0), align=uiconst.TOALL, state=uiconst.UI_DISABLED)
        if (self.width < 64):
            sprite.tripass = blue.rot.GetInstance('res:/ui/pass/linear.blue')
        loopParams = attributes.get('loopParams', self.default_loopParams)
        if loopParams:
            (direction, time,) = loopParams
            uthread.new(self.StartRotationCycle, direction, time)




